package com.foreknow.demo7;

public class StringDemo {
    public static void main(String[] args) {
        String str = "abc".concat("def");
        String newStr = str.concat("xxx");
        System.out.println("abc".concat("def").concat("xxx"));
        System.out.println("hamburger".substring(4, 8));
        System.out.println( "unhappy".substring(2));
        System.out.println("     dfas     ".trim());
        System.out.println("----------------------------------------");
        // 拆分字符串
        String s = "aa bb cc dd";
        String[] strs = s.split(" ");
        for(int i = 0;i<strs.length;i++){
            System.out.println(strs[i]);
        }

        String name = "abc";
        System.out.println("abc".equals(name));
    }
}
